package com.dawn.usermanage.bean;

import java.io.Serializable;
import java.util.Date;
import java.util.Set;

import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

import com.dawn.idolmanage.bean.IdolInfoBean;
import com.dawn.interestmanage.bean.InterestinfoBean;
import com.dawn.interestmanage.bean.UserinterestBean;
import com.dawn.trademanage.bean.TradeInfoBean;

/**
 * The persistent class for the tu_userinfo database table.
 * 
 */
@Entity
@Table(name="tu_userinfo")
public class UserBean implements Serializable {
    private static final long serialVersionUID = 1L;

    @Id
    @GeneratedValue(strategy=GenerationType.AUTO)
    private long userId;

    private int balance;

    @Temporal( TemporalType.TIMESTAMP)
    private Date createTime;

    private int grade;
    
    @Temporal( TemporalType.TIMESTAMP)
    private Date lastLoginTime;

    private int memberType;

    private String others;

    private String password;

    private String userName;
    
   // private String gender;
    
  //  private String province;
   // private String city;

    //bi-directional many-to-one association to IdolinfoBean
    @OneToMany(mappedBy="tuUserinfo")
    private Set<IdolInfoBean> tiIdolinfos;

    //bi-directional many-to-one association to TradeinfoBean
    @OneToMany(mappedBy="tuUserinfo")
    private Set<TradeInfoBean> ttTradeinfos;

    //bi-directional one-to-one association to SinainfoBean
    @OneToOne  
    @JoinColumn(name="sinaId")
    private TwSinainfo twSinainfo;

	//bi-directional many-to-many association to interestinfoBean
    @ManyToMany
	@JoinTable(
		name="tu_userinterest"
		, joinColumns={
			@JoinColumn(name="userId")
			}
		, inverseJoinColumns={
			@JoinColumn(name="interestId")
			}
		)
	private Set<InterestinfoBean> tiInterestinfos;

	public Set<InterestinfoBean> getTiInterestinfos() {
		return tiInterestinfos;
	}

	public void setTiInterestinfos(Set<InterestinfoBean> tiInterestinfos) {
		this.tiInterestinfos = tiInterestinfos;
	}

	public Set<UserinterestBean> getTuUserinterests() {
		return tuUserinterests;
	}

	public void setTuUserinterests(Set<UserinterestBean> tuUserinterests) {
		this.tuUserinterests = tuUserinterests;
	}

	//bi-directional many-to-one association to TuUserinterest
	@OneToMany(mappedBy="tuUserinfo")
	private Set<UserinterestBean> tuUserinterests;
	
	
	public long getUserId() {
        return this.userId;
    }

    public void setUserId(long userId2) {
        this.userId = userId2;
    }

    public int getBalance() {
        return this.balance;
    }

    public void setBalance(int balance) {
        this.balance = balance;
    }

    public Date getCreateTime() {
        return this.createTime;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    public int getGrade() {
        return this.grade;
    }

    public void setGrade(int grade) {
        this.grade = grade;
    }

    public Date getLastLoginTime() {
        return this.lastLoginTime;
    }

    public void setLastLoginTime(Date lastLoginTime) {
        this.lastLoginTime = lastLoginTime;
    }

    public int getMemberType() {
        return this.memberType;
    }

    public void setMemberType(int memberType) {
        this.memberType = memberType;
    }

    public String getOthers() {
        return this.others;
    }

    public void setOthers(String others) {
        this.others = others;
    }

    public String getPassword() {
        return this.password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public String getUserName() {
        return this.userName;
    }

    public void setUserName(String userName) {
        this.userName = userName;
    }

    public Set<IdolInfoBean> getTiIdolinfos() {
        return this.tiIdolinfos;
    }

    public void setTiIdolinfos(Set<IdolInfoBean> tiIdolinfos) {
        this.tiIdolinfos = tiIdolinfos;
    }
    
    public Set<TradeInfoBean> getTtTradeinfos() {
        return this.ttTradeinfos;
    }

    public void setTtTradeinfos(Set<TradeInfoBean> ttTradeinfos) {
        this.ttTradeinfos = ttTradeinfos;
    }
    
    public TwSinainfo getTwSinainfo() {
        return this.twSinainfo;
    }

    public void setTwSinainfo(TwSinainfo twSinainfo) {
        this.twSinainfo = twSinainfo;
    }

    
	/*public String getGender() {
		return gender;
	}

	public void setGender(String gender) {
		this.gender = gender;
	}

	public String getProvince() {
		return province;
	}

	public void setProvince(String province) {
		this.province = province;
	}

	public String getCity() {
		return city;
	}

	public void setCity(String city) {
		this.city = city;
	}
    */
}
